package br.com.Login.controller;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;

import br.com.Login.bean.User;

@ManagedBean(name="userLogadoMB")
@ApplicationScoped
public class UserLogadoMB {

	private List<User> lUser = new ArrayList<User>();
	
	@PostConstruct
	public void criou() {
		System.out.println("Criou UserLogado");
	}
	
	@PreDestroy
	public void morreu() {
		System.out.println("Morreu UserLogado");
	}
	
	public void addUser(User u) {
		lUser.add(u);
	}
	
	public void removeUser(User u) {
		lUser.remove(lUser.indexOf(u));
	}
	
	public Boolean verificaLogado(User u) {
		if(lUser.contains(u)){
			return true;
		}else{
			return false;
		}
	}
	
	public List<User> getlUser() {
		return lUser;
	}
	public void setlUser(List<User> lUser) {
		this.lUser = lUser;
	}
}
